home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / KEYBOARD.SWG / 0060_Keyboard Handler.pas < prev    next >
Pascal/Delphi Source File  |  1994-01-27  |  862b  |  52 lines

  1. {
  2. >Can anyone shed some light on how to add characters to the keyboard
  3. >buffers so i can echo commands right after my program exits?
  4. }
  5.  
  6. unit kb;
  7.  
  8. interface
  9.  
  10. type
  11.  
  12.   string16 = string[16];
  13. {
  14. Procedure Name: StuffKBD();
  15. Description   : Places a string of 16 chars or less into the
  16.                 keyboard buffer.
  17. Returns       : Nothing
  18. Calls         : Int 16h
  19. }
  20. procedure StuffKBD(sCommand : string16);
  21.  
  22. implementation
  23.  
  24. procedure StuffKBD(sCommand : string16);
  25. var
  26.   iStuff : integer;
  27.   ucMove : BYTE;
  28. begin
  29.   for iStuff := 1 to length(sCommand) do
  30.   begin
  31.     ucMove := byte(sCommand[iStuff]);
  32.     asm
  33.       mov ah, $5;
  34.       mov ch, $0;
  35.       mov cl, ucMove;
  36.       int     $16;
  37.     end;
  38.   end;
  39. end;
  40.  
  41. end.
  42.  
  43. program kbstuff;
  44. uses
  45.   kb;
  46.  
  47. begin
  48.    StuffKBD('kbstuff');
  49.    {You can even add StuffKBD(#13);}
  50. end.
  51.  
  52.